{include file="common/header"}
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            系统设置
            <small>文件列表</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 系统设置</a></li>
            <li class="active">文件列表</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="{:U('uploads')}">文件列表</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div class="page-content">
                            <div class="panel panel-info">
                                <div class="panel-heading">筛选</div>
                                <div class="panel-body">
                                    <form class="form-horizontal" role="form">
                                        <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">关键词</label>
                                            <div class="col-sm-8 col-md-8 col-lg-8 col-xs-12">
                                                <input type="text" class="form-control" name="keyword" value="{$_REQUEST['keyword']?$_REQUEST['keyword']:''}" placeholder="请输入关键词,文件名称">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-8 col-md-8 col-lg-8 col-xs-12 col-md-offset-2 col-lg-offset-2 col-sm-offset-4">
                                                <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                            <form method="post" class="form-horizontal" id="display_form">
                                <div class="panel panel-default ">
                                    <div class="table-responsive panel-body">
                                        <table class="table table-hover">
                                            <thead class="navbar-inner">
                                            <tr>
                                                <th style="width: 45px">删?</th>
                                                <th>文件名</th>
                                                <th>缩略图</th>
                                                <th>扩展名</th>
                                                <th>大小</th>
                                                <th>保存路径</th>
                                                <th>上传时间</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            {if condition="!empty($list)"}
                                            <tbody>
                                            {volist name="list" id="item"}
                                            <tr>
                                                <td>
                                                    <input type="checkbox" name="ids[]" value="{$item['id']}">
                                                </td>
                                                <td>{$item['filename']}</td>
                                                <td>
                                                    <img data-magnify="gallery" data-src="{:to_media($item['save_name'])}" src="{:to_media($item['save_name'])}" style="width:100px;height: auto;">
                                                </td>
                                                <td>{$item['extension']}</td>
                                                <td>{:format_file_size($item['size'])}</td>
                                                <td>{$item['save_name']}</td>
                                                <td>{$item['create_time']}</td>
                                                <td>
                                                    <button onclick="copy(this)" data-copy="{$item['save_name']}" class="btn btn-sm btn-success clipboards" type="button">复制路径</button>
                                                </td>
                                            </tr>
                                            {/volist}
                                            <tr>
                                                <td>
                                                    <input type="checkbox" onclick="var ck = this.checked;$('table').find(':checkbox').each(function(){this.checked = ck});">
                                                </td>
                                                <td colspan="6">
                                                    <button class="btn btn-sm btn-danger" name="submit" type="button">删除</button>
                                                </td>
                                            </tr>
                                            </tbody>
                                            {/if}
                                        </table>
                                    </div>
                                </div>
                            </form>
                            {$pager}
                        </div>
                        <script type="text/javascript">
                            $(function () {
                                $('button[name="submit"]').bind('click',function() {
                                    if (confirm('删除后不可恢复，您确定删除吗？')) {
                                        $.post(
                                            window.location.href,
                                            $('#display_form').serialize(),
                                            function (ret) {
                                                message(ret.message, ret.redirect, ret.type);
                                            }, 'json'
                                        );
                                    }
                                });
                            });
                        </script>
                    </div>
                    <!-- /.tab-content -->
                </div>
                <!-- /.nav-tabs-custom -->
            </div>
            <!-- /.col -->
        </div>
    </section>
</div>
{include file="common/footer"}
